ss<template>
	<view>
		<view class="content">
			<view v-if="list.length>0">
				<view class="list" v-for="(item,index) in list" :key="index">
					<view class="left">
						<view class="view">
							<view class="up">
								<image :src="getHead(item.head_image)" class="head"></image>
								<view class="name">
									{{item.nickname}}
								</view>
								<view class="tel">
									{{item.telphone}}
								</view>
							</view>
							<view class="down">
								<view class="name">
									兑换数量
								</view>
								<view class="number">
									{{item.apply_number}}
								</view>
							</view>
							<view class="down">
								<view class="line t1">
									金蜜余额 <text> {{item.jindou}}</text>
								</view>
								<view class="line t2">
									贡献值 <text> 100</text>
								</view>
							</view>
						</view>
					</view>
					<view class="icon">
						<view class="type" v-if="item.use_type==1">
							金蜜兑换
						</view>
						<view class="type" v-else>
							蜜贝兑换
						</view>
					</view>
					<view class="right">
						<view class="view" @click="checkSafePasswordEmpty(index,1)" style="margin-right: 48rpx;">
							<image src="../static/jingyan6.png" mode=""></image>
							<view class="name">
								同意
							</view>
						</view>
						<view class="view" @click="checkSafePasswordEmpty(index,2)">
							<image src="../static/jingyan7.png" mode=""></image>
							<view class="name">
								驳回
							</view>
						</view>
					</view>
				</view>
			</view>
			<view class="none" v-else>
				<view class="none-view">
					<image src="../../../static/image/none.png" class="none-image"></image>
					<view class="none-name">
						暂无相关数据~
					</view>
				</view>
			</view>
		</view>
		<u-keyboard mode="number" :dot-enabled="false" v-model="pay" :tooltip="false" @change="onChange" @backspace="onBackspace">
			<view>
				<view class="u-text-center">
					<view class="u-text-name">
						二级密码
					</view>
					<view class="u-text-text">
						您当前正在进行交易，为确保账户安全请输入二级 密码验证身份
					</view>
				</view>
				<view class="u-flex u-row-center">
					<u-message-input mode="box" :maxlength="6" :dot-fill="true" v-model="password" :disabled-keyboard="true"></u-message-input>
				</view>
				<view class="u-text-center u-padding-top-10 u-padding-bottom-20 tips"></view>
			</view>
		</u-keyboard>
	</view>
</template>

<script>
	var than;
	export default {
		data() {
			return {
				list: [],
				page: 1,
				pay: false,
				password: "",
				index: 0,
				type: 0
			}
		},
		onLoad(option) {
			than = this;
			than.listOfWaitVerify()
		},
		onShow() {},
		onReachBottom() {
			than.page++;
			than.listOfWaitVerify()
		},
		methods: {
			onChange(val) {
				if (this.password.length < 6) {
					this.password += val;
				}

				if (this.password.length >= 6) {

					if (than.type == 1) {
						than.agreeApplySell()
					} else {
						than.refuseApplySell()
					}
				}
			},
			onBackspace(e) {
				if (this.password.length > 0) {
					this.password = this.password.substring(0, this.password.length - 1);
				}
			},
			checkSafePasswordEmpty(index, type) {
				than.index = index
				than.type = type
				if (type == 1) {
					than.agreeApplySell();
				} else {
					than.refuseApplySell();
				}
				/* than.post("api/member/checkSafePasswordEmpty", null, function(data) {
					if (parseInt(data) == 0) {
						than.toast("未设置二级密码")
						uni.navigateTo({
							url: "/pages/htmlA/setting/twopassword"
						})
					} else {
						than.pay = true;
					}
				}) */
			},
			agreeApplySell(index) {
				than.post("api/teamhead/agreeExchange", {
					apply_id: than.list[than.index].apply_id,
					password: than.password
				}, function(data) {
					than.pay = false;
					than.toast(data)
					than.list.splice(than.index, 1);
				})
			},
			refuseApplySell(index) {
				than.post("api/teamhead/refuseExchange", {
					apply_id: than.list[than.index].apply_id,
					password: than.password
				}, function(data) {
					than.pay = false;
					than.toast(data)
					than.list.splice(than.index, 1);
				})
			},
			listOfWaitVerify() {
				than.post("api/teamhead/agreeExchangeGdbTicketList", {
					page: than.page,
				}, function(data) {
					if (than.page == 1) {
						than.list = data;
					} else {
						than.list = than.list.concat(data)
					}
				})
			}
		}
	}
</script>

<style lang="less">
	page {
		background: #F4F4F7;
	}

	.content {
		padding: 20rpx 36rpx;

		.list {
			background: #FFFFFF;
			border-radius: 20rpx;
			margin-bottom: 20rpx;
			height: 220rpx;
			display: flex;
			align-items: center;
			position: relative;

			.icon {
				line-height: 47rpx;
				background: #EFEFEF;
				border-radius: 0px 20rpx 0px 20rpx;
				font-size: 24rpx;
				font-family: PingFang SC;
				font-weight: 500;
				color: #666666;
				padding: 0 14rpx;
				position: absolute;
				right: 0;
				top: 0;
				height: 47rpx;
				color: #FFFFFF;
				background: linear-gradient(90deg, #FFA800, #F46813);
			}

			.left {
				margin-left: 25rpx;
				display: flex;
				align-items: center;

				.view {

					.up {
						display: flex;
						align-items: center;

						.head {
							width: 48rpx;
							height: 48rpx;
							border-radius: 50%;
						}

						.name {
							margin-left: 14rpx;
							font-size: 30rpx;
							font-family: PingFang SC;
							font-weight: bold;
							color: #333333;
						}

						.tel {
							margin-left: 13rpx;
							font-size: 26rpx;
							font-family: PingFang SC;
							font-weight: 500;
							color: #666666;
						}
					}

					.down {
						display: flex;
						align-items: center;
						margin-left: 58rpx;
						margin-top: 10rpx;

						.name {
							font-size: 30rpx;
							font-family: PingFang SC;
							font-weight: bold;
							color: #333333;
						}

						.number {
							margin-left: 13rpx;
							font-size: 36rpx;
							font-family: DIN Medium;
							font-weight: 400;
							color: #FF3C00;
						}

						.line {
							height: 42rpx;
							font-size: 24rpx;
							font-family: PingFang SC;
							font-weight: 500;
							margin-right: 16rpx;
							border-radius: 12rpx;
							line-height: 42rpx;
							padding: 0 10rpx;

							text {
								margin-left: 5rpx;
								font-size: 28rpx;
								font-family: PingFang SC;
								font-weight: bold;
							}
						}

						.t1 {
							background: #EAF2FF;
							color: #3270FF;
						}

						.t2 {
							background: #FFF4EA;
							color: #F5732E;
						}
					}
				}
			}

			.right {
				display: flex;
				align-items: center;
				margin-left: auto;
				position: absolute;
				right: 0;

				.view {
					margin-right: 24rpx;
					text-align: center;

					image {
						width: 39rpx;
						height: 39rpx;
					}

					.name {
						font-size: 22rpx;
						font-family: PingFang SC;
						font-weight: 500;
						color: #666666;
					}
				}
			}
		}
	}
</style>
